package com.example.demo.framework.utils;

import com.example.demo.framework.filters.tracer.TraceInfo;

/**
 * @Auther: miaoguoxin
 * @Date: 2020/3/20 13:44
 * @Description:
 */
public class TraceUtils {
    private static final ThreadLocal<TraceInfo> TRACE_INFO_HOLDER = new InheritableThreadLocal<TraceInfo>() {
        @Override
        protected TraceInfo initialValue() {
            return new TraceInfo();
        }
    };


    public static TraceInfo get(){
        return TRACE_INFO_HOLDER.get();
    }

    public static void set(TraceInfo traceInfo){
        TRACE_INFO_HOLDER.set(traceInfo);
    }
    public static void remove(){
        TRACE_INFO_HOLDER.remove();
    }
}
